<?php
/**
 * Created by PhpStorm.
 * User: Yieong
 * Date: 14/11/12
 * Time: 上午9:21
 */

class PubAccFilter extends LibFilter {

    protected $buttons = array();

    public function addButton($href, $title, $class=''){
        $this->buttons[] = array(
            'href'  => $href,
            'title' => $title,
            'class' => $class
        );
    }

    /**
     * 输出筛选项的展示内容
     * @return array
     */
    public function show(){
        $filters = $this->filter;

        foreach($filters as &$v){
            $attr = '';
            $args = $v['args'];
            if(isset($args['placeholder'])) $attr .= " placeholder=\"{$args['placeholder']}\" ";
            if(isset($args['style'])) $attr .= " style=\"{$args['style']}\" ";

            $v['attr'] = $attr;
        }

        return array(
            'items'     => $filters,
            'buttons'   => $this->buttons
        );
    }

} 